<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<meta name="renderer" content="webkit|ie-comp|ie-stand">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" />
<meta http-equiv="Cache-Control" content="no-siteapp" />
<!--[if lt IE 9]>
<script type="text/javascript" src="/static/lib/html5shiv.js"></script>
<script type="text/javascript" src="/static/lib/respond.min.js"></script>
<![endif]-->
<link rel="stylesheet" type="text/css" href="/static/h-ui/css/H-ui.min.css" />
<link rel="stylesheet" type="text/css" href="/static/h-ui.admin/css/H-ui.admin.css" />
<link rel="stylesheet" type="text/css" href="/static/lib/Hui-iconfont/1.0.8/iconfont.css" />
<link rel="stylesheet" type="text/css" href="/static/h-ui.admin/skin/default/skin.css" id="skin" />
<link rel="stylesheet" type="text/css" href="/static/h-ui.admin/css/style.css" />
    <script type="text/javascript" src="/static/lib/jquery/1.9.1/jquery.min.js"></script>
<!--[if IE 6]>
<script type="text/javascript" src="/static/lib/DD_belatedPNG_0.0.8a-min.js" ></script>
<script>DD_belatedPNG.fix('*');</script>
<![endif]-->
<title>用户详情</title>
<link href="/static/lib/webuploader/0.1.5/webuploader.css" rel="stylesheet" type="text/css" />
</head>
<body>
<nav class="breadcrumb"><i class="Hui-iconfont">&#xe67f;</i> 首页 <span class="c-gray en">&gt;</span> 用户管理 <span class="c-gray en">&gt;</span>用户列表<span class="c-gray en">&gt;</span> 用户详情
    <a class="btn btn-success radius r" style="line-height:1.6em;margin-top:3px" href="javascript:location.replace(location.href);" title="刷新" ><i class="Hui-iconfont">&#xe68f;</i></a></nav>
<div class="page-container">
       <div class="row cl">
			<label class="form-label col-xs-4 col-sm-2">封面图：</label>
			<div class="formControls col-xs-8 col-sm-9">
　　       <div id="test-image-preview"></div>
                <img style="width: 60px;height: 60px;margin-top: -20px;margin-bottom: 10px;" src="{{ book.cover.url }}">
			</div>
		</div>

        <div class="row cl">
			<label class="form-label col-xs-4 col-sm-2">书名：</label>
			<div class="formControls col-xs-8 col-sm-9">
				<input type="text" class="input-text" value="{{ book.name }}" placeholder="" id="name" name="name">
			</div>
		</div>
		<div class="row cl">
			<label class="form-label col-xs-4 col-sm-2">作者：</label>
			<div class="formControls col-xs-8 col-sm-9">
				<input type="text" class="input-text" value="{{ book.author }}" placeholder="" id="author" name="author">
			</div>
		</div>
        <div class="row cl">
			<label class="form-label col-xs-4 col-sm-2">分类：</label>
			<div class="formControls col-xs-8 col-sm-9">
				<input type="text" class="input-text" value="{{ book.category_name }}" placeholder="" id="category_name" name="category_name">
			</div>
		</div>
        <div class="row cl">
                <label class="form-label col-xs-4 col-sm-2">出版时间：</label>
                <div class="formControls col-xs-8 col-sm-9">
                    <input type="text" class="input-text" value="{{ book.publish_time }}" placeholder="" id="publish_time" name="publish_time">
                </div>
		</div>
		<div class="row cl">
			<label class="form-label col-xs-4 col-sm-2">出版社：</label>
			<div class="formControls col-xs-8 col-sm-9">
				<input type="text" class="input-text" value="{{ book.publish_house }}" placeholder="" id="publish_house" name="publish_house">
			</div>
		</div>
		<div class="row cl">
			<label class="form-label col-xs-4 col-sm-2">页数：</label>
			<div class="formControls col-xs-8 col-sm-9">
				<input type="text" class="input-text" value="{{ book.page_count }}" placeholder="" id="page_count" name="page_count">
			</div>
		</div>
        <div class="row cl">
			<label class="form-label col-xs-4 col-sm-2">藏书量：</label>
			<div class="formControls col-xs-8 col-sm-9">
				<input type="text" class="input-text" value="{{ book.collect_count }}" placeholder="" id="collect_count" name="collect_count">
			</div>
		</div>
        <div class="row cl">
			<label class="form-label col-xs-4 col-sm-2">剩余量：</label>
			<div class="formControls col-xs-8 col-sm-9">
				<input type="text" class="input-text" value="{{ book.remain_count }}" placeholder="" id="remain_count" name="remain_count">
			</div>
		</div>
        <div class="row cl">
			<label class="form-label col-xs-4 col-sm-2">ISBN：</label>
			<div class="formControls col-xs-8 col-sm-9">
				<input type="text" class="input-text" value="{{ book.ISBN }}" placeholder="" id="ISBN" name="ISBN">
			</div>
		</div>
        <div class="row cl">
			<label class="form-label col-xs-4 col-sm-2">添加时间：</label>
			<div class="formControls col-xs-8 col-sm-9">
				<input type="text" class="input-text" value="{{ book.add_time }}" placeholder="" id="add_time" name="add_time">
			</div>
		</div>
        <div class="row cl">
			<label class="form-label col-xs-4 col-sm-2">内容简介：</label>
			<div class="formControls col-xs-8 col-sm-9">
				<textarea name="content_introduction">{{ book.content_introduction }}</textarea>
			</div>
		</div>
        <div class="row cl">
			<label class="form-label col-xs-4 col-sm-2">作者简介：</label>
			<div class="formControls col-xs-8 col-sm-9">
				<textarea name="author_introduction">{{ book.author_introduction }}</textarea>
			</div>
		</div>
        <div class="row cl">
			<label class="form-label col-xs-4 col-sm-2">目录：</label>
			<div class="formControls col-xs-8 col-sm-9">
				<textarea name="directory">{{ book.directory }}</textarea>
			</div>
		</div>



     <div class="row cl">
             <label class="form-label col-xs-4 col-sm-2">在读图书</label>
            <div class="formControls col-xs-8 col-sm-9">
            <table class="table table-border table-bordered table-bg">
            <thead>
                <tr>
                    <th scope="col" colspan="5"><div style="float: left">现借用户</div>
                </tr>
                <tr class="text-c">
                    <th width="40">昵称</th>
                    <th width="50">手机号</th>
                    <th width="100">借书时间</th>
                    <th width="90">状态</th>
                </tr>
            </thead>
            <tbody>
            {% for line in borrow_list %}
                <tr class="text-c">
                    <td>{{ line.user.nickname }}</td>
                    <td>{{line.user.phonenumber }}</td>
                    <td>{{ line.borrow_time }}</td>
                    <td>{% if line.status==1 %} 在读 {% else %} 已还 {% endif %}</td>
                </tr>
            {% endfor %}
            </tbody>
           </table>
             </div>
         </div>

		<div class="row cl">
			<div class="col-xs-8 col-sm-9 col-xs-offset-4 col-sm-offset-2">
				<button onclick="do_change();" class="btn btn-primary radius" type="button" id="btn"><i class="Hui-iconfont">&#xe632;</i> 保存并提交审核</button>
				<button onclick="layer_close()" class="btn btn-default radius" type="button">&nbsp;&nbsp;取消&nbsp;&nbsp;</button>
			</div>
		</div>
</div>

<script>
    function layer_close() {
        document.getElementById('name').value = "{{ book.name }}"
        document.getElementById('cover').src = "{{ book.cover.url }}"
		document.getElementById('author').value = "{{ book.author }}"
		document.getElementById('category_name').value = "{{ book.category_name }}"
		document.getElementById('publish_time').value = "{{ book.publish_time }}"
		document.getElementById('publish_house').value = "{{ book.publish_house }}"
		document.getElementById('page_count').value = "{{ book.page_count }}"
		document.getElementById('collect_count').value = "{{ book.collect_count }}"
		document.getElementById('remain_count').value = "{{ book.remain_count }}"
		document.getElementById('ISBN').value = "{{ book.ISBN }}"
		document.getElementById('add_time').value = "{{ book.add_time }}"
		document.getElementById('content_introduction').innerText = "{{ book.content_introduction }}"
		document.getElementById('author_introduction').innerText = "{{ book.author_introduction }}"
		document.getElementById('directory').innerText = "{{ book.directory }}"
    }
    function do_change() {
        $.ajax({
            url: "{{ url('operation:library_change', args=(book.id, )) }}",
            type: 'POST',
            dataType: 'json',
            data: $(this).serialize(),
            success: function (data) {
                if (data.status==1)
                    alert('保存成功')
                else
                    alert('保存失败，请重试')
            },
            error: function () {
                alert('保存出错，请检查网络后重试或联系网站开发人员')
            }
        })
    }
</script>


<!--_footer 作为公共模版分离出去-->


<script type="text/javascript">
      $(function(){
          $("#test-image-file1").val("https://imgsa.baidu.com/exp/w=480/sign=581bd10a0bf3d7ca0cf63e7ec21fbe3c/cb8065380cd7912357e40240aa345982b2b780fa.jpg")
      })

      $("#btn").click(function () {
           var imgurl = document.getElementById("test-image-file1").files[0];
           var form = new FormData();
           form.append("business_id",$("#business_id").val());
           form.append("imgurl",imgurl);
           form.append("bussiness_style",$("#bussiness_style").val());
           form.append("bond_money",$("#bond_money").val());
           form.append("bussiness_name",$("#bussiness_name").val());
           form.append("bussiness_phone",$("#bussiness_phone").val());
           form.append("bussiness_way",$("#bussiness_way").val());
           form.append("bussiness_jing",$("#bussiness_jing").val());
           form.append("bussiness_wei",$("#bussiness_wei").val());
           form.append("bussiness_pu",$("#bussiness_pu").val());
           form.append("bussiness_dala",$("#bussiness_dala").val());
           form.append("bussiness_bonus",$("#bussiness_bonus").val());
　      $.ajax({
                url:"/operation/bussiness_add/",
                type:"post",
                data:form,
                processData:false,
                contentType:false,
                success:function(data){
                    window.location.href="/operation/bussiness_list/?id="+data;
                }
            });

         })
</script>
</body>
</html>